package aop

import (
	"log"
)

type Target struct {
}

type aspect interface {
	Before(fn func() error) error
	After(fn func() error) error
	Around(fn func() error) error
}

func Before(fn func() error) error {
	log.Println("before")
	return fn()
}

func After(fn func() error) error {
	err := fn()
	log.Println("after")
	return err
}

func Around(fn func() error) error {
	log.Println("around before")
	err := fn()
	log.Println("around after")
	return err
}

func (t *Target) run() error {
	log.Println("target run")
	return nil
}
